/** Подтверждения при кликах по элементам интерфейса **/

var Confirm = { };

(function() {
    var _phrase = function(element) {
        var classes = element.className.split(/\s+/),
            phrase = 'Do you really want to delete this item?';
        $.each(Confirm, function(name, contents) {
            if ($.inArray(name, classes) >= 0) {
                phrase = contents;
                return false;
            }
        });
        return phrase;
    }
    $(document).bind('click', function(e){
        if ($(e.target).hasClass('confirm') && !window.confirm(_phrase(e.target))) {
            e.preventDefault();
            e.stopPropagation();
        }
    });
})();
